<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        let user = {id:1,name:'name1'}
        for(let attr in user){
            document.write(attr + '-' + user[attr]);
            document.write("<br/>")
        }
    </script>
</head>
<body>

</body>
</html>